#include "mainwidget.h"
#include "ui_mainwidget.h"

MainWidget::MainWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWidget)
{
    ui->setupUi(this);
    this->resize(600,800);
    label =  new QLabel(tr("this is Main"),this);
    label->move(300,400);
    firstBtn = new QPushButton(tr("go to First"),this);
    firstBtn ->move(300,500);
    secondBtn = new QPushButton(tr("go to Second"),this);
    secondBtn ->move(300,600);
    connect(firstBtn,&QPushButton::clicked,
            this,&MainWidget::gotoFirst);
    connect(secondBtn,&QPushButton::clicked,
           this,&MainWidget::gotoSecond);
}
MainWidget::~MainWidget()
{
    delete ui;
}

void MainWidget::gotoFirst()
{
    this->hide();
    emit mainToFirst();
}

void MainWidget::gotoSecond()
{
    this->hide();
    emit mainToSecond();
}
